import Vue from 'vue'
import VueRouter from 'vue-router'
import home from '../views/home.vue'
import users from '../views/users.vue'
import product from '../views/product.vue'
import login from '../views/login.vue'

Vue.use(VueRouter)

const routes = [{
        path: '/',
        redirect: '/login'
    }, {
        path: '/login',
        component: login,
    }, {
        path: '/home',
        name: 'Home',
        component: home,
        redirect: '/dashBoard',
        children: [{
            path: '/dashBoard',
            component: () =>
                import ('../views/dashBoard.vue')
        }, {
            path: '/users',
            component: users
        }, {
            path: '/product',
            component: product
        }]
    }]
    // const routes = [{
    //         path: '/login',
    //         redirect: '/login'
    //     }, {
    //         path: '/login',
    //         component: login
    //     },
    //     {
    //         path: '/home',
    //         component: home,
    //         children: [{
    //                 path: '/users',
    //                 component: users
    //             },
    //             {
    //                 path: '/product',
    //                 component: product,
    //             }
    //         ]
    //     }
    // ]

const router = new VueRouter({
    routes
})

export default router